-
Notifications
You must be signed in to change notification settings - Fork 64
upgradability: key rotation of the auditor public key #1026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ed93e7a
to
c7ec9db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo comments
for _, auditorSignature := range ctx.TokenRequest.AuditorSignatures { | ||
auditor := auditorSignature.Identity | ||
// check that issuer of this issue action is authorized | ||
found := false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this like this
found := slices.Contains(auditors, auditorSignature.Identity.Equal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay slices.ContainsFunc
.
if err != nil { | ||
return errors.Wrapf(err, "failed to deserialize auditor's public key") | ||
} | ||
_, err = ctx.SignatureProvider.HasBeenSignedBy(auditor, verifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, HasBeenSignedBy has to be called in the right order. Would it make sense to check in any order and keep a counter of how many have been checked already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking in any order is expensive because we would need to verify the signatures against multiple public keys.
Anyhow, a driver can use a different implementation of SignatureProvider
as you suggest, sure.
@@ -248,13 +265,36 @@ func (v *Validator[P, T, TA, IA, DS]) verifyTransfer(tr TA, ledger driver.Ledger | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean if c >= 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, one time is okay.
Deserializer: v.Deserializer, | ||
TransferAction: tr, | ||
TransferAction: action, | ||
Ledger: ledger, | ||
SignatureProvider: signatureProvider, | ||
MetadataCounter: map[MetadataCounterID]int{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I don't find very neat here is that sometimes we pass a transfer action in the context, sometimes an issue action and sometimes none. I would pass none of them and then have different validator types:
type TransferValidator interface {
Validate(Context, TransferAction)
}
Similarly for IssueValidator
and AuditValidator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sounds like a task to add to the #930
} | ||
|
||
func (r *AuditorSignature) FromProtos(tr *request.AuditorSignature) error { | ||
if tr.Identity != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also if tr == nil
if it can happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if we need to address this in another PR.
func newAuditingViewInitiator(tx *Transaction, local bool) *AuditingViewInitiator { | ||
return &AuditingViewInitiator{tx: tx, local: local} | ||
func newAuditingViewInitiator(tx *Transaction, local, skipAuditorSignatureVerification bool) *AuditingViewInitiator { | ||
return &AuditingViewInitiator{tx: tx, local: local, skipAuditorSignatureVerification: skipAuditorSignatureVerification} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include a testing feature in this view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean?
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
No description provided.